package service.Impl;

import dao.FreelancerRepository;
import dao.Impl.FreelancerRepositoryImpl;
import dao.Impl.ProjectRepositoryImpl;
import dao.ProjectRepository;
import entity.Freelancer;
import entity.Project;
import service.FreelancerService;
import service.ProjectService;

import java.util.ArrayList;

public class ProjectServiceImpl implements ProjectService {

    /**
     * 获取项目信息表
     */
    @Override
    public ArrayList<Project> getProjectList(){
        ProjectRepository projectRepository = new ProjectRepositoryImpl();
        return projectRepository.getProjectList();
    }

    /**
     * 添加项目信息
     */
    @Override
    public boolean addProject(Project project) {
        ProjectRepository projectRepository = new ProjectRepositoryImpl();
        return projectRepository.addProject(project);
    }

    /**
     * 根据项目编号返回项目信息
     */
    @Override
    public Project findById(Integer projectId) {
        ProjectRepository projectRepository = new ProjectRepositoryImpl();
        return projectRepository.findById(projectId);
    }
    /**
     * 修改项目信息
     */
    @Override
    public boolean updateProject(Project project) {
        ProjectRepository projectRepository = new ProjectRepositoryImpl();
        return projectRepository.updateProject(project);
    }

    /**
     * 根据项目编号删除项目信息
     */
    @Override
    public boolean deleteProject(Integer projectId) {
        ProjectRepository projectRepository = new ProjectRepositoryImpl();
        return projectRepository.deleteProject(projectId);
    }

}
